package org.gwt.grin.rebind.features;

import java.util.Formatter;

import org.gwt.grin.client.features.Clipped;
import org.gwt.grin.client.util.Rectangle;
import org.gwt.grin.rebind.ShowBuilder;

public class SEClipped extends SEModifier {

	private final Rectangle clipRegion;

	public SEClipped(String name, Rectangle clipRegion) {
		super(name);
		this.clipRegion = clipRegion;
	}

	@Override
	public String write(ShowBuilder builder) {
		String cn = getClassName();
		Formatter formatter = new Formatter();
		formatter.format("new %s(\"%s\", %s, %s)", cn,
				name, makeRectangle(clipRegion), getPart().getVN(builder));
		return formatter.toString();
	}

	@Override
	protected String getClassName() {
		return Clipped.class.getName();
	}

}
